t: dt: fps: avg fps: frames per phys: phys dt: use measured dt * let dir = keys_down.has("ArrowRight") - keys_down.has("ArrowLeft"); let h_hat = r90ccw(gravity); h_hat.mag = 1; if (h_hat[0] < 0 || h_hat[1] < 0 || mousedown) h_hat = minus(h_hat); const current_speed = vel.dot(h_hat); const desired_speed = movement_speed * dir; const friction = onGround? movement_accel : (keys_down.has("ArrowLeft") || keys_down.has("ArrowRight"))?air_accel:air_hdrag; accel = plus(accel,times(h_hat,friction*(desired_speed-current_speed))); ok collision state:
t:
dt:
fps:
avg fps:
frames per phys:
phys dt:
use measured dt
*
collision state: